-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL] Add validation + exception handling to SYCL_PARALLEL_FOR_RANGE_ROUNDING_PARAMS #19381
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
AlexeySachkov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have a test added for the change
|
@intel/llvm-reviewers-runtime PR ready for review, thanks in advance! |
| if (Pos != std::string::npos) { | ||
| MF = std::stoi(Params.substr(0, Pos)); | ||
| if (Pos != std::string::npos && GuardedStoi(MF, Params.substr(0, Pos)) && | ||
| MF > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be MF >= 0 ( GTE instead of GT) ? 0 is a valid return from GuardedStoi, no? Or maybe 0 should not be valid in GuardedStoi.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way we currently have range rounding, MF=0 results in a division by zero error: This PR helps prevent the crash that would happen as a result.
I don't think it makes sense anyway, as according to https://github.com/intel/llvm/blob/970e2ef386e6287202cbaf69ff3871889bed5959/sycl/doc/EnvironmentVariables.md, the minimum factor is the "range that the rounded range should be a multiple of (Default 16)": Rounding parallel_for ranges to a multiple of 0 should probably not be possible. Thus, I have a test case to explicitly check that MF=0 should not be accepted.
|
@cperkinsintel Mind if I ask you to take a look again? Thanks! |
|
@intel/llvm-gatekeepers PR is ready for merge, thanks! |
|
Can you add a PR description? |
Done 👍 |
|
Thx! |
Bad / nonsensical values in
SYCL_PARALLEL_FOR_RANGE_ROUNDING_PARAMSresult in division by 0 crashes. This PR: